﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Asplode.GameEntity.Characters;

namespace Asplode.GameWorld
{
    public class AsplodeMap
    {
        public Model model;

        private Matrix[] walls = new Matrix[4];
        private Matrix floor = new Matrix();

        private int _width;
        public int Width
        {
            get
            {
                return _width;
            }
            set
            {
                _width = value;
                redoTransforms();
            }
        }

        private AsplodeCamera _camera;
        public AsplodeCamera Camera
        {
            get
            {
                return _camera;
            }
        }

        private Matrix _projection;
        public Matrix CameraProjection
        {
            get
            {
                return _projection;
            }
        }

        public int _depth;
        public int Depth
        {
            get
            {
                return _depth;
            }
            set
            {
                _depth = value;
                redoTransforms();
            }
        }

        public AsplodeMap(GraphicsDevice GraphicsDevice)
        {
            this.Width = 5;
            this.Depth = 5;
            _projection = new Matrix();
            _projection = Matrix.CreatePerspectiveFieldOfView(
                MathHelper.ToRadians(45.0f),
                GraphicsDevice.Viewport.AspectRatio, 1.0f, 10000f);
            _camera = new AsplodeCamera();
            Camera.CameraMode = AsplodeCamera.Mode.TopDown;
        }

        public void LoadContent(ContentManager cm)
        {
            model = cm.Load<Model>("Models\\cube");
        }

        private void redoTransforms()
        {
            //floor
            floor = Matrix.CreateScale(Width, 1, Depth);
            //Matrix.CreateTranslation(0,-0.5f,0);

            // deep wall


            //walls[0] = Matrix.CreateScale(width, 5, depth)
            //        *Matrix.CreateTranslation(;


        }
    }
}
